import http from '../util/http.js';

export default {
    getAdminList:()=>{
      return http({
          method: 'get',
          url: 'api/tadmin/list'
      });
    },
    getSupplyList:()=>{
        return http({
            method: 'get',
            url: 'api/supplying/list'
        });
    },

    /*对商品的数据操作*/
    productGetOne: (id) => {
        return http({url: 'api/product/' + id, method: 'get'});
    },
    productGetPage: async (current, size) => {
        const val = await http({
            url: 'api/product/page', method: 'get',
            //提供表单数据
            params: {current, size}
        });
        console.log("---------------");
        console.log(val);
        return val;
    },

    productDelete: (id) => {
        http({
            url: "api/product/" + id,
            method: 'delete'
        });
    },
    productEdit: (obj) => {
        console.log(obj);
        return http({
            url: "api/product/",
            method: 'PUT',
            //提交json数据
            data: obj,
            headers: {
                //定义将数据以json的形式传入后台(java)
                'Content-Type': 'application/json'
            }
        });
    },
}